import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
// import { createRouter, createWebHistory } from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/login.vue"),
  },
  { // 教师处理试题页面
    path: "/teacher",
    name: "Home",
    component: Home,
  },
  { // 教师编辑试题页面
    path: "/edit",
    name: "edit",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/editTest.vue"),
  },
  { // 考试界面
    path: "/test",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/config",
    name: "Config",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/config.vue"),
  },
  { // 学生导入试题页面
    path: "/index",
    name: "student",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/student.vue"),
  },
];

const router = new VueRouter({
  // mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
